package testing;

import java.util.*;

import junit.framework.*;
import logicaDePredicados.Pair;
import org.junit.Test;

public class PairTest { 


	@Test
	public void testPairCollection() { 

		Map< Pair<String, String>, String> hm1 = new HashMap<Pair<String,String>, String>(); 

		Pair<String, String> p1 = new Pair<String, String>("Test1", "Value1"); 
		hm1.put(p1, "ONE");  
		Pair<String, String> p2 = new Pair<String, String>("Test1", "Value2"); 
		hm1.put(p2, "TWO");  
		Pair<String, String> p3 = new Pair<String, String>("Test2", "Value1"); 
		hm1.put(p3, "THREE");    
		Pair<String, String> p4 = new Pair<String, String>("Test2", "Value2"); 
		hm1.put(p4, "FOUR"); 
		Pair<String, String> p5 = new Pair<String, String>("Test3", "Value1"); 
		hm1.put(p5, "FIVE"); 
		Pair<String, String> p6 = new Pair<String, String>("Test3", "Value2"); 
		hm1.put(p6, "SIX");  
		Pair<String, String> p7 = new Pair<String, String>("Test3", "Value3"); 
		hm1.put(p7, "SEVEN");    

		Assert.assertTrue( hm1.size() == 7 ); 
		String str1= "Test";
		String str2= "Test";
		System.out.println(str1.hashCode()==str2.hashCode());
		
		Pair<String, String> pSrch = new Pair<String, String>("Test3", "Value3");
		System.out.println("starting containsKey search");
		Assert.assertTrue( hm1.containsKey( p7 ) );
		System.out.println("starting containsKey search2");
		Assert.assertNotNull( hm1.containsKey(  new Pair<String, String>("Test3", "Value3") ) );
		Assert.assertNotNull(hm1.get(pSrch));
		System.out.println(hm1.get(pSrch));
		
	}
}